#pragma once

#include "iostream"
using namespace std;

class Filter {
private:
  double data[5] = {};//默认全部初始化为0
  double weight[5] = {10, 15, 20, 25, 30}; //默认百分比
  int cnt = 0;
 
private:
  void data_move_left() { 
    //数据模型：a,b,c,d,0;
    for (int k = 0; k <= 3; k++) {
      data[k] = data[k + 1];
    }
    data[4] = 0;
  }

public:
  Filter() {}
  Filter(double w1, double w2, double w3, double w4, double w5) {
    weight[0] = w1;
    weight[1] = w2;
    weight[2] = w3;
    weight[3] = w4;
    weight[4] = w5;
  }

  double filtered_value(double new_data);
};